"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const tiny_entity2_1 = require("tiny-entity2");
const EntityObjectType = tiny_entity2_1.EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
let Order = class Order extends EntityObjectType {
    constructor() {
        super(...arguments);
        this.invoiceAmount = 0;
    }
};
__decorate([
    tiny_entity2_1.Define.PrimaryKey(),
    __metadata("design:type", String)
], Order.prototype, "id", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
        NotAllowNULL: true
    }),
    __metadata("design:type", String)
], Order.prototype, "orderNo", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR
    }),
    __metadata("design:type", String)
], Order.prototype, "serialNo", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
        NotAllowNULL: true
    }),
    __metadata("design:type", String)
], Order.prototype, "orderIdentity", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.BIGINT,
        NotAllowNULL: true
    }),
    __metadata("design:type", Number)
], Order.prototype, "createTime", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.BIGINT,
        IsIndex: true
    }),
    __metadata("design:type", Number)
], Order.prototype, "closeTime", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.BIGINT
    }),
    __metadata("design:type", Number)
], Order.prototype, "reportTime", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    }),
    __metadata("design:type", String)
], Order.prototype, "status", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    }),
    __metadata("design:type", String)
], Order.prototype, "type", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR
    }),
    __metadata("design:type", String)
], Order.prototype, "note", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
        IsIndex: true
    }),
    __metadata("design:type", String)
], Order.prototype, "refOrderId", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.Decimal,
        DefaultValue: 0,
        DataLength: 10,
        DecimalPoint: 3
    }),
    __metadata("design:type", Number)
], Order.prototype, "subTotal", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.Decimal,
        DefaultValue: 0,
        DataLength: 10,
        DecimalPoint: 3
    }),
    __metadata("design:type", Number)
], Order.prototype, "amount", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.Decimal,
        DefaultValue: 0,
        DataLength: 10,
        DecimalPoint: 3
    }),
    __metadata("design:type", Number)
], Order.prototype, "discount", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.Decimal,
        DefaultValue: 0,
        DataLength: 10,
        DecimalPoint: 3
    }),
    __metadata("design:type", Number)
], Order.prototype, "remainAmount", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.Decimal,
        DefaultValue: 0,
        DataLength: 10,
        DecimalPoint: 3
    }),
    __metadata("design:type", Number)
], Order.prototype, "paidAmount", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
        NotAllowNULL: true
    }),
    __metadata("design:type", String)
], Order.prototype, "operatorId", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
        NotAllowNULL: true
    }),
    __metadata("design:type", String)
], Order.prototype, "operatorName", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR
    }),
    __metadata("design:type", String)
], Order.prototype, "cashierId", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR
    }),
    __metadata("design:type", String)
], Order.prototype, "cashierName", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR
    }),
    __metadata("design:type", String)
], Order.prototype, "memberId", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR
    }),
    __metadata("design:type", String)
], Order.prototype, "memberName", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR
    }),
    __metadata("design:type", String)
], Order.prototype, "memberSource", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.INT
    }),
    __metadata("design:type", Number)
], Order.prototype, "counterTimes", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.INT
    }),
    __metadata("design:type", Number)
], Order.prototype, "printTimes", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR
    }),
    __metadata("design:type", String)
], Order.prototype, "tableServiceLogId", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.Decimal,
        DefaultValue: 0
    }),
    __metadata("design:type", Number)
], Order.prototype, "invoiceAmount", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
    }),
    __metadata("design:type", String)
], Order.prototype, "invoiceNote", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.INT,
        DataLength: 10,
        DefaultValue: 0
    }),
    __metadata("design:type", Number)
], Order.prototype, "customerCount", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
    }),
    __metadata("design:type", String)
], Order.prototype, "source", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
    }),
    __metadata("design:type", String)
], Order.prototype, "deliveryStatus", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    }),
    __metadata("design:type", String)
], Order.prototype, "storeId", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.JSON,
    }),
    __metadata("design:type", Object)
], Order.prototype, "extend", void 0);
__decorate([
    tiny_entity2_1.Define.Column({
        DataType: tiny_entity2_1.Define.DataType.BIGINT
    }),
    __metadata("design:type", Number)
], Order.prototype, "version", void 0);
__decorate([
    tiny_entity2_1.Define.Mapping({
        Mapping: 'OrderItem',
        MappingKey: 'masterOrderId'
    }),
    __metadata("design:type", Array)
], Order.prototype, "orderItems", void 0);
__decorate([
    tiny_entity2_1.Define.Mapping({
        Mapping: 'OrderDiscount',
        MappingKey: 'orderId'
    }),
    __metadata("design:type", Array)
], Order.prototype, "orderDiscounts", void 0);
__decorate([
    tiny_entity2_1.Define.Mapping({
        Mapping: 'OrderPayment',
        MappingKey: 'orderId'
    }),
    __metadata("design:type", Array)
], Order.prototype, "orderPayments", void 0);
__decorate([
    tiny_entity2_1.Define.Mapping({
        Mapping: 'OrderCounter',
        MappingKey: 'orderId'
    }),
    __metadata("design:type", Array)
], Order.prototype, "orderCounters", void 0);
Order = __decorate([
    tiny_entity2_1.Define.Table({ TableName: "orders" })
], Order);
exports.Order = Order;
exports.OrderType = {
    Sales: 'sales',
    PreOrder: 'preOrder',
    Refund: 'refund',
    Remind: 'remind',
    CheckOut: 'checkout',
    MemberRecharge: 'memberRecharge',
    Delivery: 'delivery'
};
exports.OrderDeliveryStatus = {
    Ordered: 'ordered',
    Refund: 'refund',
    Cancelled: 'cancelled',
    Closed: 'closed'
};
exports.OrderStatus = {
    Init: 'init',
    Ordered: 'ordered',
    Closed: 'closed',
    Cancelled: 'cancelled',
    Settlement: 'settlement',
    PreSettlement: 'presettlement',
    Merged: 'merged',
    Refund: 'refund'
};
